package com.alinesno.cloud.base.logger.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.alinesno.cloud.base.logger.entity.LogSystemExceptionEntity;
import com.alinesno.cloud.base.logger.service.ILogSystemExceptionService;
import com.alinesno.cloud.common.core.service.impl.IBaseServiceImpl;
import com.alinesno.cloud.common.facade.wrapper.RestWrapper;

/**
 * <p> 系统异常 服务实现类 </p>
 *
 * @author WeiXiaoJin
 * @since 2020-01-26 09:30:11
 */
@Service
public class LogSystemExceptionServiceImpl extends IBaseServiceImpl<LogSystemExceptionEntity, String> implements ILogSystemExceptionService {

	//日志记录
	@SuppressWarnings("unused")
	private static final Logger log = LoggerFactory.getLogger(LogSystemExceptionServiceImpl.class);

	@Override
	public LogSystemExceptionEntity findByMethodKey(String methodKey) {
		List<LogSystemExceptionEntity> o =  this.findAll(RestWrapper.create().eq("methodKey", methodKey).toSpecification());
		if(o != null && o.size()>0) {
			return o.get(0) ;
		}
		return null ; 
	}

}
